<template>
    <div>
        <el-form 
        :model="overtime" 
        :rules="rules" ref="overtime" 
        v-loading="go"
        element-loading-text="正在跳转请稍等"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(0, 0, 0, 0.8)" label-width="100px" class="demo-ruleForm">
            <el-row style=" padding-left:30px; padding-top:20px;">
                <el-col :span="24">
                    <div class="grid-content bg-purple-dark">
                        <br>
                        <div class="kuang"></div>
                        <span style=" padding-left:40px;" >基本信息</span>
                        <div class="xian"></div>
                        <div class="kuai">
                            <!-- 新增补卡start -->
                                    <el-form-item label="规则名称" prop="overtimeName">
                                        <el-input v-model="overtime.overtimeName" placeholder="请输入" style="width:400px;"></el-input>
                                    </el-form-item>
                                    <el-form-item label="引用范围" prop="overtimeApplyId">
                                        <el-select v-model="overtime.overtimeApplyId" placeholder="请选择">
                                        <el-option
                                            v-for="item in options"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value">
                                        </el-option>
                                        </el-select>
                                    </el-form-item>
                                <!-- 选择负责人start -->
                                    <el-form-item :label="title.overtimeHead" prop="overtimeHead">
                                        <div class="avatar-uploader">
                                            <!-- 选中负责人后展示start -->
                                            <div v-if="selectedUser!=''" >
                                                <img  :src="selectedUser.icon" class="avatar" @click="headPage=true">
                                                <span style="position: relative;top: -17px;left: 20px;">{{ selectedUser.nickName }}
                                                    <span style="margin-left: 26px;cursor: pointer;" @click="deUser">X</span>
                                                </span>
                                            </div>
                                            <!-- 选中负责人后展示end -->
                                            <!-- 负责人未选中展示 -->
                                            <i v-else @click="headPage=true" class="el-icon-plus avatar-uploader-icon"></i>
                                        </div>
                                    </el-form-item>
                                    
                                    <el-dialog
                                        v-loading="loading"
                                        element-loading-text="拼命加载中"
                                        element-loading-spinner="el-icon-loading"
                                        element-loading-background="rgba(0, 0, 0, 0.8)"
                                        :visible.sync="headPage"
                                        width="50%"
                                        :show-close="false">
                                        <el-breadcrumb separator-class="el-icon-arrow-right">
                                            <!-- 步骤条start -->
                                            <el-breadcrumb-item  v-for="(value,index) in headNavs" :key="index+'E'" @click="upNav(index)">
                                                <el-button v-if="persons.id==undefined" size="mini" style="border: 0px;" @click="upNav(index)">{{ value }}</el-button>
                                            </el-breadcrumb-item>
                                            <!-- 步骤条end -->
                                            <br>
                                            <br>
                                            <br>
                                            <!-- 展示右边所选中的用户start -->
                                            <div style="float: right;margin-top: -70px;margin-right:30%;color: black;">
                                                已选择<span v-if="selectedUser!=''">1</span><span v-else>0</span>位联系人
                                                <br>
                                                <br>
                                                <br>
                                            </div>
                                            <!-- 展示选中的用户 -->
                                            <div  v-if="selectedUser!=''" class="architecture" style="height: 50px;float: right;    position: relative;top: 12px;right: 50px;">
                                                <img style="width: 30px;height: 30px;position: relative;top: 10px;" :src="selectedUser.icon"/>
                                                <span style="margin-left: 17%;color: black;color: black;font-size: 10px;display: block;margin-top: -20px;">
                                                    {{ selectedUser.nickName }}<br><br>
                                                    {{ selectedUser.tposition.deptName }}
                                                    <span style="float: right;margin-top: -10px;margin-right: 20px;cursor: pointer;" @click="deUser">X</span>
                                                </span>
                                                
                                            </div>
                                            <!-- 展示右边所选中的用户end -->
                                            <!-- 展示左边信息start -->
                                            <!-- 展示部门和人数start -->
                                            <div class="architecture" style="line-height: 39px;" v-for="(value,perIndex) in persons" :key="perIndex" @click="selectArchitecture(value.deptName)">
                                                <div class="log">
                                                    <img src="https://cdn7.axureshop.com/demo2023/2236859/images/%E8%AF%B7%E5%81%87/u2303.svg" />
                                                </div>
                                                <span style="margin-left: 5%;color: black;">
                                                    {{ value.deptName }}
                                                </span>
                                                &nbsp;&nbsp;&nbsp;({{ value.deptCount }})
                                                <span style="float: right;margin-right: 20px;">
                                                    ＞
                                                </span>
                                            </div>
                                            <!-- 展示部门和人数end -->
                                            <br>
                                            <!-- 展示当前所选部门的所有用户start -->
                                            <div v-if="users.length!=0">
                                                <div :class="[selectArchitectureCss != userIndex ?'architecture': '',selectArchitectureCss == userIndex ? 'architectureActe':'']" style="height: 50px;"  v-for="(myUser,userIndex) in users" :key="userIndex" @click="selectUser(userIndex)">
                                                    <el-radio style="width: 80%;height: 100%;" v-model="selectId" :label="userIndex">
                                                        &nbsp;&nbsp;&nbsp;
                                                        <img style="width: 30px;height: 30px;position: relative;top: 10px;" :src="myUser.icon"/>
                                                        <span style="margin-left: 5%;color: black;font-size: 10px;float: left;position: relative;top: 12px;left: 110px;">
                                                            {{ myUser.nickName }}<br><br>
                                                            {{ myUser.tposition.deptName }}
                                                        </span>
                                                        
                                                    </el-radio>
                                                    <span>
                                                            ＞
                                                    </span>
                                                </div>
                                            </div>
                                            <!-- 展示当前所选部门的所有用户start -->
                                            <!-- 展示左边信息end -->
                                            
                                        </el-breadcrumb>

                                        <!-- 竖直分割线 -->
                                        <div class="myHr"></div>
                                        
                                       
                                        <span slot="footer" class="dialog-footer">
                                            <el-button @click="headPage = false">取 消</el-button>
                                            <el-button type="primary" @click="headPage = false">确 定</el-button>
                                        </span>
                                    </el-dialog>
                                <!-- 选择负责人end -->
                                <el-menu :default-active="overtime.weekday" class="el-menu-demo" mode="horizontal" @select="handleSelect">
                                    <el-menu-item index="0">工作日</el-menu-item>
                                    <el-menu-item index="1">休息日</el-menu-item>
                                    <el-menu-item index="2">节假日</el-menu-item>
                                </el-menu>
                                <br>
                                <div v-if="overtime.weekday=='0'">

                                    <el-form-item label="允许加班" prop="replacementApplyId">
                                        <el-switch
                                            v-model="overtime.overtimeStatic"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upData">
                                        </el-switch>
                                    </el-form-item>
                                    <el-form-item label="计算方式" prop="overtimeManner">
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.overtimeManner" label="0"  @change="upData">按照审批时间计算</el-radio><br>
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.overtimeManner" label="1"  @change="upData">按审批的时间</el-radio><br>
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.overtimeManner" label="2"  @change="upData">外勤大可需要拍照</el-radio>
                                    </el-form-item>
                                        <el-form-item  label="加班起算时间" prop="startTime">
                                            上班前 
                                            <div style="width: 100px; display: inline;" @mouseover="upWorkBoolen=true" @mouseleave="upWorkBoolen=false">
                                                <el-input-number :disabled="overtime.overtimeStatic==1" style="width: 100px;" v-model="upWork" :min="1" :controls="upWorkBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            分钟不计入加班<br><br>
                                            下班后 
                                            <div style="width: 100px; display: inline;" @mouseover="downWorkBoolen=true" @mouseleave="downWorkBoolen=false">
                                                <el-input-number :disabled="overtime.overtimeStatic==1" style="width: 100px;" v-model="downWork" :min="1" :controls="downWorkBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            分钟不计入加班
                                        </el-form-item>
                                        
                                        <el-form-item label="最小加班时间" prop="minTime">
                                            班前加班至少 
                                            <div style="width: 100px; display: inline;" @mouseover="upOvertimeBoolen=true" @mouseleave="upOvertimeBoolen=false">
                                                <el-input-number :disabled="overtime.overtimeStatic==1" style="width: 100px;" v-model="upOvertime" :min="1" :controls="upOvertimeBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            分钟<br><br>
                                            班后加班至少 
                                            <div style="width: 100px; display: inline;" @mouseover="downOvertimeBoolen=true" @mouseleave="downOvertimeBoolen=false">
                                                <el-input-number :disabled="overtime.overtimeStatic==1" style="width: 100px;" v-model="downOvertime" :min="1" :controls="downOvertimeBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            分钟<br><br>
                                            累计加班至少 
                                            <div style="width: 100px; display: inline;" @mouseover="cumulativeOvertimeBoolen=true" @mouseleave="cumulativeOvertimeBoolen=false">
                                                <el-input-number :disabled="overtime.overtimeStatic==1" style="width: 100px;" v-model="cumulativeOvertime" :min="1" :controls="cumulativeOvertimeBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            分钟
                                        </el-form-item>
                                    <el-form-item label="扣除休息时间" prop="breaks">
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.breaks" label="0" @change="upData">不扣除</el-radio><br>
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.breaks" label="1" @change="upData">
                                            按固定休息时间扣除<br><br>
                                                <div v-for="(value,index) in count" :key="index" style="display: inline">
                                                    <span v-if="index%2==0">
                                                        休息时间 <el-time-picker
                                                            v-model="value.startName"
                                                            :picker-options="{
                                                            selectableRange: '00:00:00 - 23:59:59'
                                                            }"
                                                            placeholder="任意时间点" :disabled="overtime.breaks==1?false:true"
                                                            style="width: 120px;"
                                                            value-format="yyyy-MM-dd HH:mm:ss">
                                                        </el-time-picker> - 
                                                    </span>
                                                    <span v-if="index%2!=0">
                                                        <el-time-picker
                                                            v-model="value.endName"
                                                            :picker-options="{
                                                            selectableRange: '00:00:00 - 23:59:59'
                                                            }"
                                                            placeholder="任意时间点" :disabled="overtime.breaks==1?false:true"
                                                            style="width: 120px;"
                                                            value-format="yyyy-MM-dd HH:mm:ss">
                                                        </el-time-picker>&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <i v-if="index>2" @click="delData(index)" class="el-icon-remove-outline"></i>
                                                        <br>
                                                        <br>
                                                    </span>
                                                    
                                                </div>
                                                <el-button type="text" @click="addTime" :disabled="overtime.breaks==1?false:true" icon="el-icon-circle-plus-outline">添加时段</el-button>
                                        </el-radio>
                                        <br>
                                        <br>
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.breaks" label="2" @change="upData">
                                            按照加班时长扣除<br><br>
                                            <div v-for="(value,index) in overtimeHours" :key="index" style="display: inline">
                                                <span v-if="index%2==0">
                                                    每天加班满
                                                    <div style="width: 100px; display: inline;" @mouseover="overtimeHoursStartBoolen=true" @mouseleave="overtimeHoursStartBoolen=false">
                                                        <el-input-number style="width: 100px;" :disabled="overtime.breaks==2?false:true" v-model="value.startName" :min="1" :controls="overtimeHoursStartBoolen" controls-position="right"></el-input-number>
                                                    </div>
                                                    小时，
                                                </span>
                                                <span v-if="index%2!=0">
                                                    扣除
                                                    <div style="width: 100px; display: inline;" @mouseover="overtimeHoursEndBoolen=true" @mouseleave="overtimeHoursEndBoolen=false">
                                                        <el-input-number style="width: 100px;" :disabled="overtime.breaks==2?false:true" v-model="value.endName" :min="1" :controls="overtimeHoursEndBoolen" controls-position="right"></el-input-number>
                                                    </div>
                                                    小时
                                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                                    <i v-if="index>2" @click="delOvertimeRestHours(index)" class="el-icon-remove-outline"></i>

                                                    <br>
                                                    <br>
                                                </span>
                                                
                                            </div>
                                            <el-button type="text" @click="addOvertimeHours" :disabled="overtime.breaks==2?false:true" icon="el-icon-circle-plus-outline">添加条件</el-button>

                                        </el-radio>
                                        <br>
                                        
                                    </el-form-item>
                                    <el-form-item label="结算方式" prop="overtimeSettlement">
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.overtimeSettlement" label="0"  @change="upData">
                                            结算为加班费
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.overtimeSettlement" label="1" @change="upData">
                                            结算为调休，按照 1 : 
                                            <div style="width: 100px; display: inline;" @mouseover="compensatoryLeaveBoolen=true" @mouseleave="compensatoryLeaveBoolen=false">
                                                <el-input-number style="width: 100px;" :disabled="overtime.overtimeSettlement==1?false:true" :step="0.5" v-model="overtime.compensatoryLeave" :min="1" :controls="compensatoryLeaveBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            计为调休时长
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.overtimeSettlement" label="2" @change="upData">
                                            员工自主选择，可自主选择结算为加班费或以 1 : 
                                            <div style="width: 100px; display: inline;" @mouseover="compensatoryLeaveBoolen=true" @mouseleave="compensatoryLeaveBoolen=false">
                                                <el-input-number style="width: 100px;" :disabled="overtime.overtimeSettlement==2?false:true" :step="0.5" v-model="overtime.compensatoryLeave" :min="1" :controls="compensatoryLeaveBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            计为调休时长
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="overtime.overtimeStatic==1" v-model="overtime.overtimeSettlement" label="3" @change="upData">
                                            制作记录，暂不结算
                                        </el-radio>
                                        <br>
                                    </el-form-item>
                                    <el-form-item label="是否需要审批" prop="replacementApplyId">
                                        <el-switch
                                            :disabled="overtime.overtimeStatic==1"
                                            v-model="overtime.approval"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upData">
                                        </el-switch>
                                    </el-form-item>
                                    <el-form-item label="打卡时间计算" prop="replacementApplyId">
                                        <el-switch
                                            :disabled="overtime.overtimeStatic==1"
                                            v-model="overtime.overtimeClock"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upData">
                                        </el-switch>
                                    </el-form-item>

                                </div>

                                <div v-if="overtime.weekday=='1'">
                                    <el-form-item label="允许加班" prop="replacementApplyId">
                                        <el-switch
                                            v-model="rest.overtimeStatic"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upRestData">
                                        </el-switch>
                                    </el-form-item>
                                    <el-form-item label="计算方式" prop="overtimeManner">
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.overtimeManner" label="0">按照审批时间计算</el-radio><br>
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.overtimeManner" label="1">按审批的时间</el-radio><br>
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.overtimeManner" label="2">外勤大可需要拍照</el-radio>
                                    </el-form-item>
                                    <el-form-item label="扣除休息时间" prop="breaks">
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.breaks" label="0" @change="upRestData">不扣除</el-radio><br>
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.breaks" label="1" @change="upRestData">
                                            按固定休息时间扣除<br><br>
                                                <div v-for="(value,index) in restCount" :key="index" style="display: inline">
                                                    <span v-if="index%2==0">
                                                        休息时间 <el-time-picker
                                                            v-model="value.startName"
                                                            :picker-options="{
                                                            selectableRange: '00:00:00 - 23:59:59'
                                                            }"
                                                            placeholder="任意时间点" :disabled="rest.breaks==1?false:true"
                                                            style="width: 120px;"
                                                            value-format="yyyy-MM-dd HH:mm:ss">
                                                        </el-time-picker> - 
                                                    </span>
                                                    <span v-if="index%2!=0">
                                                        <el-time-picker
                                                            v-model="value.endName"
                                                            :picker-options="{
                                                            selectableRange: '00:00:00 - 23:59:59'
                                                            }"
                                                            placeholder="任意时间点" :disabled="rest.breaks==1?false:true"
                                                            style="width: 120px;"
                                                            value-format="yyyy-MM-dd HH:mm:ss">
                                                        </el-time-picker>&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <i v-if="index>2" @click="delRestData(index)" class="el-icon-remove-outline"></i>
                                                        <br>
                                                        <br>
                                                    </span>
                                                    
                                                </div>
                                                <el-button type="text" @click="addRestTime" :disabled="rest.breaks==1?false:true" icon="el-icon-circle-plus-outline">添加时段</el-button>
                                        </el-radio>
                                        <br>
                                        <br>
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.breaks" label="2" @change="upRestData()">
                                            按照加班时长扣除<br><br>
                                            <div v-for="(value,index) in overtimeRestHours" :key="index" style="display: inline">
                                                <span v-if="index%2==0">
                                                    每天加班满
                                                    <div style="width: 100px; display: inline;" @mouseover="overtimeHoursStartBoolen=true" @mouseleave="overtimeHoursStartBoolen=false">
                                                        <el-input-number style="width: 100px;" :disabled="rest.breaks==2?false:true" v-model="value.startName" :min="1" :controls="overtimeHoursStartBoolen" controls-position="right"></el-input-number>
                                                    </div>
                                                    小时，
                                                </span>
                                                <span v-if="index%2!=0">
                                                    扣除
                                                    <div style="width: 100px; display: inline;" @mouseover="overtimeHoursEndBoolen=true" @mouseleave="overtimeHoursEndBoolen=false">
                                                        <el-input-number style="width: 100px;" :disabled="rest.breaks==2?false:true" v-model="value.endName" :min="1" :controls="overtimeHoursEndBoolen" controls-position="right"></el-input-number>
                                                    </div>
                                                    小时
                                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                                    <i v-if="index>2" @click="delOvertimeRestHours(index)" class="el-icon-remove-outline"></i>

                                                    <br>
                                                    <br>
                                                </span>
                                                
                                            </div>
                                            <el-button type="text" @click="addOvertimeRestHours" :disabled="rest.breaks==2?false:true" icon="el-icon-circle-plus-outline">添加条件</el-button>

                                        </el-radio>
                                        <br>
                                        
                                    </el-form-item>
                                    <el-form-item label="结算方式" prop="overtimeSettlement">
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.overtimeSettlement" label="0"  @change="upRestData">
                                            结算为加班费
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.overtimeSettlement" label="1" @change="upRestData">
                                            结算为调休，按照 1 : 
                                            <div style="width: 100px; display: inline;" @mouseover="compensatoryLeaveBoolen=true" @mouseleave="compensatoryLeaveBoolen=false">
                                                <el-input-number style="width: 100px;" :disabled="rest.overtimeSettlement==1?false:true" :step="0.5" v-model="rest.compensatoryLeave" :min="1" :controls="compensatoryLeaveBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            计为调休时长
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.overtimeSettlement" label="2" @change="upRestData">
                                            员工自主选择，可自主选择结算为加班费或以 1 : 
                                            <div style="width: 100px; display: inline;" @mouseover="compensatoryLeaveBoolen=true" @mouseleave="compensatoryLeaveBoolen=false">
                                                <el-input-number style="width: 100px;" :disabled="rest.overtimeSettlement==2?false:true" :step="0.5" v-model="rest.compensatoryLeave" :min="1" :controls="compensatoryLeaveBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            计为调休时长
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="rest.overtimeStatic==1" v-model="rest.overtimeSettlement" label="3" @change="upRestData">
                                            制作记录，暂不结算
                                        </el-radio>
                                        <br>
                                    </el-form-item>
                                    <el-form-item label="是否需要审批" prop="replacementApplyId">
                                        <el-switch
                                            :disabled="rest.overtimeStatic==1"
                                            v-model="rest.approval"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upRestData">
                                        </el-switch>
                                    </el-form-item>
                                    <el-form-item label="打卡时间计算" prop="replacementApplyId">
                                        <el-switch
                                            :disabled="rest.overtimeStatic==1"
                                            v-model="rest.overtimeClock"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upRestData">
                                        </el-switch>
                                    </el-form-item>

                                </div>
                                <div v-if="overtime.weekday=='2'">
                                    <el-form-item label="允许加班" prop="replacementApplyId">
                                        <el-switch
                                            v-model="holidays.overtimeStatic"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upHolidaysData">
                                        </el-switch>
                                    </el-form-item>
                                    <el-form-item label="计算方式" prop="overtimeManner">
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.overtimeManner" label="0">按照审批时间计算</el-radio><br>
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.overtimeManner" label="1">按审批的时间</el-radio><br>
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.overtimeManner" label="2">外勤大可需要拍照</el-radio>
                                    </el-form-item>
                                    <el-form-item label="扣除休息时间" prop="breaks">
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.breaks" label="0" @change="upHolidaysData">不扣除</el-radio><br>
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.breaks" label="1" @change="upHolidaysData">
                                            按固定休息时间扣除<br><br>
                                                <div v-for="(value,index) in holidaysCount" :key="index" style="display: inline">
                                                    <span v-if="index%2==0">
                                                        休息时间 <el-time-picker
                                                            v-model="value.startName"
                                                            :picker-options="{
                                                            selectableRange: '00:00:00 - 23:59:59'
                                                            }"
                                                            placeholder="任意时间点" :disabled="holidays.breaks==1?false:true"
                                                            style="width: 120px;"
                                                            value-format="yyyy-MM-dd HH:mm:ss">
                                                        </el-time-picker> - 
                                                    </span>
                                                    <span v-if="index%2!=0">
                                                        <el-time-picker
                                                            v-model="value.endName"
                                                            :picker-options="{
                                                            selectableRange: '00:00:00 - 23:59:59'
                                                            }"
                                                            placeholder="任意时间点" :disabled="holidays.breaks==1?false:true"
                                                            style="width: 120px;"
                                                            value-format="yyyy-MM-dd HH:mm:ss">
                                                        </el-time-picker>&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <i v-if="index>2" @click="delHolidaysData(index)" class="el-icon-remove-outline"></i>
                                                        <br>
                                                        <br>
                                                    </span>
                                                    
                                                </div>
                                                <el-button type="text" @click="addHolidaysTime" :disabled="holidays.breaks==1?false:true" icon="el-icon-circle-plus-outline">添加时段</el-button>
                                        </el-radio>
                                        <br>
                                        <br>
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.breaks" label="2" @change="upHolidaysData">
                                            按照加班时长扣除<br><br>
                                            <div v-for="(value,index) in overtimeHolidaysHours" :key="index" style="display: inline">
                                                <span v-if="index%2==0">
                                                    每天加班满
                                                    <div style="width: 100px; display: inline;" @mouseover="overtimeHoursStartBoolen=true" @mouseleave="overtimeHoursStartBoolen=false">
                                                        <el-input-number style="width: 100px;" :disabled="holidays.breaks==2?false:true" v-model="value.startName" :min="1" :controls="overtimeHoursStartBoolen" controls-position="right"></el-input-number>
                                                    </div>
                                                    小时，
                                                </span>
                                                <span v-if="index%2!=0">
                                                    扣除
                                                    <div style="width: 100px; display: inline;" @mouseover="overtimeHoursEndBoolen=true" @mouseleave="overtimeHoursEndBoolen=false">
                                                        <el-input-number style="width: 100px;" :disabled="holidays.breaks==2?false:true" v-model="value.endName" :min="1" :controls="overtimeHoursEndBoolen" controls-position="right"></el-input-number>
                                                    </div>
                                                    小时
                                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                                    <i v-if="index>2" @click="delOvertimeHolidaysHours(index)" class="el-icon-remove-outline"></i>

                                                    <br>
                                                    <br>
                                                </span>
                                                
                                            </div>
                                            <el-button type="text" @click="addOvertimeHolidaysHours" :disabled="holidays.breaks==2?false:true" icon="el-icon-circle-plus-outline">添加条件</el-button>

                                        </el-radio>
                                        <br>
                                        
                                    </el-form-item>
                                    <el-form-item label="结算方式" prop="overtimeSettlement">
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.overtimeSettlement" label="0"  @change="upHolidaysData">
                                            结算为加班费
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.overtimeSettlement" label="1" @change="upHolidaysData">
                                            结算为调休，按照 1 : 
                                            <div style="width: 100px; display: inline;" @mouseover="compensatoryLeaveBoolen=true" @mouseleave="compensatoryLeaveBoolen=false">
                                                <el-input-number style="width: 100px;" :disabled="holidays.overtimeSettlement==1?false:true" :step="0.5" v-model="holidays.compensatoryLeave" :min="1" :controls="compensatoryLeaveBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            计为调休时长
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.overtimeSettlement" label="2" @change="upHolidaysData">
                                            员工自主选择，可自主选择结算为加班费或以 1 : 
                                            <div style="width: 100px; display: inline;" @mouseover="compensatoryLeaveBoolen=true" @mouseleave="compensatoryLeaveBoolen=false">
                                                <el-input-number style="width: 100px;" :disabled="holidays.overtimeSettlement==2?false:true" :step="0.5" v-model="holidays.compensatoryLeave" :min="1" :controls="compensatoryLeaveBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            计为调休时长
                                        </el-radio>
                                        <br>
                                        <el-radio :disabled="holidays.overtimeStatic==1" v-model="holidays.overtimeSettlement" label="3" @change="upHolidaysData">
                                            制作记录，暂不结算
                                        </el-radio>
                                        <br>
                                    </el-form-item>
                                    <el-form-item label="是否需要审批" prop="replacementApplyId">
                                        <el-switch
                                            :disabled="holidays.overtimeStatic==1"
                                            v-model="holidays.approval"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upHolidaysData">
                                        </el-switch>
                                    </el-form-item>
                                    <el-form-item label="打卡时间计算" prop="replacementApplyId">
                                        <el-switch
                                            :disabled="holidays.overtimeStatic==1"
                                            v-model="holidays.overtimeClock"
                                            active-value="0"
                                            inactive-value="1"
                                            @change="upHolidaysData">
                                        </el-switch>
                                    </el-form-item>

                                </div>


                                <div class="kuang"></div>
                                <span style=" padding-left:40px;" >更多设置</span>
                                <div class="xian"></div>
                                <br>
                                <el-form-item label="加班时长单位" prop="breaks">
                                    <el-select v-model="overtime.overtimeTimeUnit" placeholder="请选择">
                                        <el-option
                                        v-for="item in overtimeTimeUnits"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                                <br>
                                <el-form-item label="取整方式" prop="breaks">
                                    加班时长
                                    <el-select v-model="overtimeTime" placeholder="请选择">
                                        <el-option
                                        v-for="item in overtimeTimes"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                    不足
                                    <div style="width: 100px; display: inline;" @mouseover="overtimeHourBoolen=true" @mouseleave="overtimeHourBoolen=false">
                                        <el-input-number style="width: 100px;" v-model="overtimeHour" :min="1" :controls="overtimeHourBoolen" controls-position="right"></el-input-number>
                                    </div>
                                    小时的按1小时计算
                                </el-form-item>
                                <br>
                                <el-form-item label="日折算时长" prop="overtimeMax">
                                    <div style="width: 100px; display: inline;" @mouseover="overtimeConvertedBoolen=true" @mouseleave="overtimeConvertedBoolen=false">
                                        <el-input-number style="width: 100px;" v-model="overtime.overtimeConverted" :min="1" :controls="overtimeConvertedBoolen" controls-position="right"></el-input-number>
                                    </div>
                                    小时=一天
                                </el-form-item>
                                <br>
                                <el-form-item label="加班上限" prop="breaks">
                                    <div v-for="(value,index) in overtimeTypes" :key="index" style="display: inline">
                                        <span v-if="index%2==0">
                                            <el-select v-model="value.startName" placeholder="请选择">
                                                <el-option
                                                v-for="item in days"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </span>
                                        <span v-if="index%2!=0">
                                            最多加班
                                            <div style="width: 100px; display: inline;" @mouseover="overtimeTypeHourBoolen=true" @mouseleave="overtimeTypeHourBoolen=false">
                                                <el-input-number style="width: 100px;" v-model="value.endName" :min="1" :controls="overtimeTypeHourBoolen" controls-position="right"></el-input-number>
                                            </div>
                                            小时，超出部分不计入加班
                                            <i v-if="index>2" @click="delovertimeTypeHouer(index)" class="el-icon-remove-outline"></i>
                                            <br> 
                                            <br>
                                        </span> 
                                    </div>
                                    <el-button type="text" @click="addovertimeTypeHour"  icon="el-icon-circle-plus-outline">添加时段</el-button>
                                </el-form-item>
                                

                                <el-form-item>
                                    <el-button @click="resetForm('overtime')" style="width: 127px;height: 36px;">取消</el-button>
                                    <el-button type="primary" @click="submitForm('overtime')" style="width: 127px;height: 36px;">
                                        提交<br><br>
                                    </el-button>
                                </el-form-item>
                                <br><br><br>
                            <!-- 新增补卡end -->
                        </div>
                    </div>
                </el-col>
            </el-row>
        </el-form>
    </div>
  
</template>

<script>
import axios from 'axios'
import qs from 'qs';
export default {
    name:"overtimeAdd",
    data(){
        return{
            // 登录成功跳转页面加载
            go:false,
            overtime:{
                overtimeHead:"",
                weekday:"0",
                overtimeManner:""
            },
            title:{
                overtimeHead:"负责人",
            },
            options: [{
                value: 0,
                label: '全公司考勤'
            }],
            rules: {
                rulesName: [
                    { required: true, message: '请输入规则名称', trigger: 'blur' }
                ],
                overtimeHead:[
                    { required: true, message: '请输入选择负责人', trigger: 'blur' }
                ],
            },
            // 获取负责人start
            headPage:false,//开启选择负责人页面
            headNavs:["组织架构"],//步骤条
            persons:[],//部门和部门人数
            users:[],//所选部门的人员
            loading:false,//加载开启和关闭
            selectArchitectureCss:-1,//选中指定行后开启指定的css
            selectId:-1,//单选框
            selectedUser:"",//选中的用户
            //  获取负责人end

            // 默认选择是工作日，
            activeIndex:"1",


            // 鼠标是否悬浮在上班input上面出现加减箭头
            upWorkBoolen:false,
            // 上班前参数
            upWork:undefined,
            // 鼠标是否悬浮在下班input上面出现加减箭头
            downWorkBoolen:false,
            // 下班后参数
            downWork:undefined,


            // 鼠标是否悬浮在班前加班input上面出现加减箭头
            upOvertimeBoolen:false,
            // 班前加班
            upOvertime:undefined,
            // 鼠标是否悬浮在班后加班input上面出现加减箭头
            downOvertimeBoolen:false,
            // 班后加班
            downOvertime:undefined,
            // 鼠标是否悬浮在累计加班input上面出现加减箭头
            cumulativeOvertimeBoolen:false,
            // 累计加班
            cumulativeOvertime:undefined,

            // 扣除加班时长input上面出现加减箭头
            overtimeHoursStartBoolen:false,
            // 加班满多少小时
            overtimeHoursStart:undefined,
            // 扣除加班时长input上面出现加减箭头
            overtimeHoursEndBoolen:false,
            //  扣除时间
            overtimeHoursEnd:undefined,

            // 扣除休息时间
            count : [{startName:""},{endName:""}],
            // 加班扣除
            overtimeHours :[{startName:undefined},{endName:undefined}],

            // 调休时长input上面出现加减箭头
            compensatoryLeaveBoolen:false,

            // 日这结算
            overtimeConvertedBoolen:false,
            
            // 结算方式
            overtimeTimeUnits:[
                {
                    value: 0,
                    label: '分钟'
                },
                {
                    value: 1,
                    label: '半个小时'
                },
                {
                    value: 2,
                    label: '小时'
                },
                {
                    value: 3,
                    label: '半天'
                },
                {
                    value: 4,
                    label: '整天'
                }
            ],
            overtimeTimes:[
                {
                    value: "0",
                    label: '四舍五入' 
                },
                {
                    value: "1",
                    label: '向上取整' 
                },
                {
                    value: "2",
                    label: '向下取整' 
                },
            ],

            //加班上限所有信息
            days:[
                {
                    value: "0",
                    label: '每天' 
                },
                {
                    value: "1",
                    label: '每周' 
                },
                {
                    value: "2",
                    label: '每月' 
                },
            ],
            // 加班上线时间的指针展示和隐藏
            overtimeTypeHourBoolen :false,
            //加班上限选择多选框
            overtimeTypes:[{startName:""},{endName:undefined}],
            // 加班时长设置
            overtimeTime:undefined,
            // 不足小时赋值
            overtimeHour:undefined,
            // 不足小时箭头展示和隐藏
            overtimeHourBoolen:false,

            // 休息日对象start
            rest:{
                    overtimeStatic:1,
                },
            // 扣除休息时间
            restCount : [{startName:""},{endName:""}],
            // 加班扣除
            overtimeRestHours :[{startName:""},{endName:""}],

            // 休息日对象end

             // 节假日对象start
             holidays:{
                    overtimeStatic:1,
                },
            // 扣除休息时间
            holidaysCount : [{startName:""},{endName:""}],
            // 加班扣除
            overtimeHolidaysHours :[{startName:""},{endName:""}],

            // 节假日对象end
            
        } 
    },
    created(){
        this.getReplacementApplyId();
        this.getDept();//获取部门
        let id = this.$route.params.id;
        if(id != undefined){
            this.getOvertime(id);
        }


    },
    methods: {
        // 获取应用范围
        getReplacementApplyId(){
            axios.post("/ReplacementCard/findTreeEntity")
            .then((res)=>{
                for (const iterator of res.data) {
                    this.options.push({
                        value:iterator.id,
                        label:iterator.label
                    });
                }
            })
        },
        // 提交事务
        submitForm(formName) {
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    this.go = true;
                    let weekday = undefined;
                    if(this.overtime.overtimeStatic=="0"){
                        let date = [];
                        let nowDate = null;
                        if(this.overtime.breaks=="1"){
                            for (const key in this.count) {
                                if(key%2==0){
                                    nowDate = this.count[key].startName+"|";
                                }else{
                                    nowDate += this.count[key].endName;
                                    date.push(nowDate);
                                    nowDate = null;

                                }
                            }
                        }else if(this.overtime.breaks=="2"){
                            for (const key in this.overtimeHours) {
                                if(key%2==0){
                                    nowDate = this.overtimeHours[key].startName;
                                }else{
                                    nowDate = this.overtimeHours[key].endName;
                                }
                                date.push(nowDate);

                            }
                        }
                        weekday = {
                            overtimeStatic:this.overtime.overtimeStatic,
                            overtimeManner:this.overtime.overtimeManner,
                            startTime:this.upWork+","+this.downWork,
                            minTime:this.upOvertime+","+this.downOvertime+","+this.cumulativeOvertime,
                            breaks:this.overtime.breaks,
                            overtimeTime:date.toString(),
                            overtimeSettlement:this.overtime.overtimeSettlement,
                            compensatoryLeave:this.overtime.compensatoryLeave,
                            approval:this.overtime.approval,
                            overtimeClock:this.overtime.overtimeClock,
                        }
                    }
                    let restday = undefined;
                    if(this.rest.overtimeStatic=="0"){
                        let date = [];
                        let nowDate = null;
                        if(this.rest.breaks=="1"){
                            for (const key in this.restCount) {
                                if(key%2==0){
                                    nowDate = this.restCount[key].startName+"|";
                                }else{
                                    nowDate += this.restCount[key].endName;
                                    date.push(nowDate);
                                    nowDate = null;
    
                                }
                            }
                        }else if(this.rest.breaks=="2"){
                            for (const key in this.overtimeRestHours) {
                                if(key%2==0){
                                    nowDate = this.overtimeRestHours[key].startName;
                                }else{
                                    nowDate = this.overtimeRestHours[key].endName;
                                }
                                date.push(nowDate);
    
                            }
                        }
                        restday = {
                            overtimeStatic:this.rest.overtimeStatic,
                            overtimeManner:this.rest.overtimeManner,
                            breaks:this.rest.breaks,
                            overtimeTime:date.toString(),
                            overtimeSettlement:this.rest.overtimeSettlement,
                            compensatoryLeave:this.rest.compensatoryLeave,
                            approval:this.rest.approval,
                            overtimeClock:this.rest.overtimeClock,

                        }
                    }
                    let holiday = undefined;
                    if(this.holidays.overtimeStatic=="0"){
                        let date = [];
                        let nowDate = null;
                        if(this.holidays.breaks=="1"){
                            for (const key in this.holidaysCount) {
                                if(key%2==0){
                                    nowDate = this.holidaysCount[key].startName+"|";
                                }else{
                                    nowDate += this.holidaysCount[key].endName;
                                    date.push(nowDate);
                                    nowDate = null;
                                }
                            }
                        }else if(this.holidays.breaks=="2"){
                            for (const key in this.overtimeHolidaysHours) {
                                if(key%2==0){
                                    nowDate = this.overtimeHolidaysHours[key].startName;
                                }else{
                                    nowDate = this.overtimeHolidaysHours[key].endName;
                                }
                                date.push(nowDate);

                            }
                        }
                        holiday = {
                            overtimeStatic:this.holidays.overtimeStatic,
                            overtimeManner:this.holidays.overtimeManner,
                            breaks:this.holidays.breaks,
                            overtimeTime:date.toString(),
                            overtimeSettlement:this.holidays.overtimeSettlement,
                            compensatoryLeave:this.holidays.compensatoryLeave,
                            approval:this.holidays.approval,
                            overtimeClock:this.holidays.overtimeClock,

                        }

                    }
                    if(this.overtime.week!=undefined){
                        weekday.id = this.overtime.week.id;
                    }
                    if(this.overtime.rest!=undefined){
                        restday.id = this.overtime.rest.id;
                    }
                    if(this.overtime.holi!=undefined){
                        holiday.id = this.overtime.holi.id;
                    }

                    axios.post("/user/findUserByToken")
                    .then((res)=>{
                        this.overtime.createdBy = res.data;
                        let date = [];
                        let nowDate = null;
                        this.overtime.overtimeRound = this.overtimeTime+","+this.overtimeHour;
                        for (const key in this.overtimeTypes) {
                            if(key%2==0){
                                nowDate = this.overtimeTypes[key].startName;
                            }else{
                                nowDate = this.overtimeTypes[key].endName;
                            }
                            date.push(nowDate);

                        }
                        this.overtime.overtimeMax = date.toString();
                        this.overtime.datesBOS = [];
                        this.overtime.datesBOS.push(weekday);
                        this.overtime.datesBOS.push(restday);
                        this.overtime.datesBOS.push(holiday);
                        axios.post("/overtime/addOrUpOvertime",this.overtime)
                        .then((res)=>{
                            if(res.data==1){
                                this.$message({
                                    message:"提交成功!!!!!",
                                    type:"success"
                                });
                                let myTime = setTimeout(()=>{
                                    res.data = -1;
                                    this.$router.go(-1);
                                },3000);
                            }else{
                                this.$message({
                                    message:"提交失败，请重试",
                                    type:"error"
                                });
                                this.go = false;
                                setInterval(()=>{
                                    this.$router.go(0);
                                },3000);
                            }
                            
                        })
                    })
                } else {
                    return false;

                }
            });
        },
        // 重置事务
        resetForm(formName) {
            this.$router.go(-1);
        },
        // 负责人start
        // 更新步骤条
        upNav(index){
            this.headNavs = this.headNavs.slice(0,index+1);
            if("组织架构"==this.headNavs){
                this.loading = true;
                this.users = [];
                this.getDept();
            }
        },
        // 获取部门及部门人数
        getDept(){
            this.selectId=-1;
            this.deUser();
            axios.post("/ReplacementCard/findDept")
            .then((res)=>{
                this.persons = res.data.rows;
                this.loading = false;
            })
        },
        // 获取所选择部门的用户信息
        selectArchitecture(value){
            this.loading = true;
            this.persons = [];
            this.headNavs.push(value);
            var data = new FormData();
            data.append("name",value)
            axios.post("/ReplacementCard/findUserAndDept",data)
            .then((res)=>{
                this.users = res.data.rows;
                if(this.users!=[]){
                    this.loading = false;
                }
            })

        },
        // 是否允许补卡更改重置和他相关联的值
        reset(){
            if(!this.overtime.card){
                this.overtime.replacementCount = undefined;
                this.overtime.time = undefined;
            }

        },

        // 选中用户
        selectUser(index){
            this.selectArchitectureCss = index;
            this.selectedUser = this.users[index];
            this.overtime.overtimeHead = this.selectedUser.id;
        },

        // 删除用户
        deUser(){
            this.selectId=-1;
            this.selectedUser="";
            this.selectArchitectureCss = -1;
            this.overtime.overtimeHead = "";
        },
        // 负责人end
        
        //  获取指定补卡信息
        getOvertime(id){
            this.go = true;
            let data = new FormData();
            data.append("id",id);
            axios.post("/overtime/findOvertimeOne",data)
            .then((res)=>{
                console.log(res.data.rows)
                this.overtime = res.data.rows;
                if(this.overtime.id!=null){
                    this.overtime.weekday = "0";
                    axios.post("/demo/findOneUser?id="+this.overtime.overtimeHead)
                    .then((res)=>{
                        this.selectedUser = res.data;

                        if(this.overtime.week!=null && this.overtime.week.overtimeStatic=="0"){
                            this.overtime.overtimeStatic = this.overtime.week.overtimeStatic+"";
                            this.overtime.overtimeManner = this.overtime.week.overtimeManner+"";
                            let startTime = this.overtime.week.startTime;
                            this.upWork = startTime[0];
                            this.downWork = startTime[2];
                            this.upOvertime = this.overtime.week.minTime[0];
                            this.downOvertime = this.overtime.week.minTime[2];
                            this.cumulativeOvertime = this.overtime.week.minTime[4];
                            this.overtime.breaks = this.overtime.week.breaks;
                            if(this.overtime.breaks=="1"){
                                let time = this.overtime.week.overtimeTime.split(",")
                                // this.count
                                for (const key in time) {
                                    if(key==0){
                                        this.count = [{startName:time[key].split("|")[0]},{endName:time[key].split("|")[1]}];
                                    }else{
                                        this.count.push({startName:time[key].split("|")[0]},{endName:time[key].split("|")[1]})
                                    }
                                    
                                }
                            }else if(this.overtime.breaks=="2"){
                                let time = this.overtime.week.overtimeTime.split(",")
                                // this.count
                                for (const key in time) {
                                    if(key==0){
                                        this.overtimeHours=[];
                                    }
                                    if(key%2==0){
                                        this.overtimeHours.push({startName:time[key]});
                                    }else{
                                        this.overtimeHours.push({endName:time[key]});
                                    }
                                    
                                }
                            }
                            this.overtime.overtimeSettlement = this.overtime.week.overtimeSettlement;
                            this.overtime.compensatoryLeave= this.overtime.week.compensatoryLeave
                            this.overtime.approval = this.overtime.week.approval+"";
                            this.overtime.overtimeClock = this.overtime.week.overtimeClock+"";
                        }
                        if(this.overtime.rest!=null && this.overtime.rest.overtimeStatic=="0"){
                            this.rest.overtimeStatic = this.overtime.rest.overtimeStatic+"";
                            this.rest.overtimeManner = this.overtime.rest.overtimeManner+"";

                            this.rest.breaks = this.overtime.rest.breaks;
                            if(this.rest.breaks=="1"){
                                let time = this.overtime.rest.overtimeTime.split(",")
                                // this.count
                                for (const key in time) {
                                    if(key==0){
                                        this.restCount = [{startName:time[key].split("|")[0]},{endName:time[key].split("|")[1]}];
                                    }else{
                                        this.restCount.push({startName:time[key].split("|")[0]},{endName:time[key].split("|")[1]})
                                    }
                                    
                                }
                            }else if(this.rest.breaks=="2"){
                                let time = this.overtime.rest.overtimeTime.split(",")
                                // this.count
                                for (const key in time) {
                                    if(key==0){
                                        this.overtimeHours=[];
                                    }
                                    if(key%2==0){
                                        this.overtimeRestHours.push({startName:time[key]});
                                    }else{
                                        this.overtimeRestHours.push({endName:time[key]});
                                    }
                                    
                                }
                            }
                            this.rest.overtimeSettlement = this.overtime.rest.overtimeSettlement;
                            this.rest.compensatoryLeave= this.overtime.rest.compensatoryLeave
                            this.rest.approval = this.overtime.rest.approval+"";
                            this.rest.overtimeClock = this.overtime.rest.overtimeClock+"";
                        }

                        if(this.overtime.holi!=null && this.overtime.holi.overtimeStatic=="0"){
                            this.holidays.overtimeStatic = this.overtime.holi.overtimeStatic+"";
                            this.holidays.overtimeManner = this.overtime.holi.overtimeManner+"";

                            this.holidays.breaks = this.overtime.holi.breaks;
                            if(this.holidays.breaks=="1"){
                                let time = this.overtime.holi.overtimeTime.split(",")
                                // this.count
                                for (const key in time) {
                                    if(key==0){
                                        this.holidaysCount = [{startName:time[key].split("|")[0]},{endName:time[key].split("|")[1]}];
                                    }else{
                                        this.holidaysCount.push({startName:time[key].split("|")[0]},{endName:time[key].split("|")[1]})
                                    }
                                    
                                }
                            }else if(this.holidays.breaks=="2"){
                                let time = this.overtime.holi.overtimeTime.split(",")
                                // this.count
                                for (const key in time) {
                                    if(key==0){
                                        this.overtimeHolidaysHours=[];
                                    }
                                    if(key%2==0){
                                        this.overtimeHolidaysHours.push({startName:time[key]});
                                    }else{
                                        this.overtimeHolidaysHours.push({endName:time[key]});
                                    }
                                    
                                }
                            }
                            this.holidays.overtimeSettlement = this.overtime.holi.overtimeSettlement;
                            this.holidays.compensatoryLeave= this.overtime.holi.compensatoryLeave
                            this.holidays.approval = this.overtime.holi.approval+"";
                            this.holidays.overtimeClock = this.overtime.holi.overtimeClock+"";
                        }

                        this.overtimeTime = this.overtime.overtimeRound[0]+"";
                        this.overtimeHour = this.overtime.overtimeRound[2];
                        let max = this.overtime.overtimeMax.split(",");
                        for (const key in max) {
                            if(key==0){
                                this.overtimeTypes = [];
                            }
                            if (key%2==0) {
                                this.overtimeTypes.push({startName:max[key]});
                            }else{
                                this.overtimeTypes.push({endName:max[key]});
                            }
                        }
                        
                        
                        this.go = false;
                    })
                    
                }
            })
        },
        // 选择工作日等
        handleSelect(key, keyPath) {
            this.overtime.weekday = keyPath[0];
        },
        // 添加时间段
        addTime(){
            let num = this.count.length;
            if(num<6){
                this.count.push({startName:""});
                this.count.push({endName:""});
            }else{
                this.$message({
                    message:"最多只能选添加三个",
                    type:"warning"
                })
            }
        },
        // 重置默认状态
        upData(){
            if(this.overtime.breaks!=1){
                this.count = [{startName:""},{endName:""}];
            }
            if(this.overtime.breaks!=2){
                this.overtimeHours = [{startName:""},{endName:""}];
            }
        },
        // 删除时间段
        delData(index){
            this.count.splice(index-1,index-1);
        },
        // 添加条件
        addOvertimeHours(){
            let num = this.overtimeHours.length;
            if(num<6){
                this.overtimeHours.push({startName:""});
                this.overtimeHours.push({endName:""});
            }else{
                this.$message({
                    message:"最多只能选添加三个",
                    type:"warning"
                })
            }
        },
        // 删除添加的条件
        delOvertimeHours(index){
            this.overtimeHours.splice(index-1,index-1);
        },
        // 重置
        resetCompensatoryLeave(){
            this.overtime.compensatoryLeave = undefined;
        },
       
        // 添加加班上线
        addovertimeTypeHour(){
            let num = this.overtimeTypes.length;
            if(num<6){
                this.overtimeTypes.push({startName:0});
                this.overtimeTypes.push({endName:""});
            }else{
                this.$message({
                    message:"最多只能选添加三个",
                    type:"warning"
                })
            }
        },
        // 删除加班上线新增的条件
        delovertimeTypeHouer(index){
            this.overtimeTypes.splice(index-1,index-1);;
        },


        // 休息日的方法 start

        // 添加时间段
        addRestTime(){
            let num = this.restCount.length;
            if(num<6){
                this.restCount.push({startName:""});
                this.restCount.push({endName:""});
            }else{
                this.$message({
                    message:"最多只能选添加三个",
                    type:"warning"
                })
            }
        },


        // 添加条件
        addOvertimeRestHours(){
            let num = this.overtimeRestHours.length;
            if(num<6){
                this.overtimeRestHours.push({startName:""});
                this.overtimeRestHours.push({endName:""});
            }else{
                this.$message({
                    message:"最多只能选添加三个",
                    type:"warning"
                })
            }
        },

        // 重置默认状态
        upRestData(){
            if(this.rest.breaks!=1){
                this.restCount = [{startName:undefined},{endName:undefined}];
            }
            if(this.rest.breaks!=2){
                this.overtimeRestHours = [{startName:undefined},{endName:undefined}];
            }
        },

        // 删除时间段
        delRestData(index){
            this.restCount.splice(index-1,index-1);
        },
        // 删除添加的条件
        delOvertimeRestHours(index){
            this.overtimeRestHours.splice(index-1,index-1);
        },
        // 重置
        resetCompensatoryLeaveRest(){
            this.rest.compensatoryLeave = undefined;
        },
        // 休息日方法 end



         // 节假日的方法 start

        // 添加时间段
        addHolidaysTime(){
            let num = this.holidaysCount.length;
            if(num<6){
                this.holidaysCount.push({startName:""});
                this.holidaysCount.push({endName:""});
            }else{
                this.$message({
                    message:"最多只能选添加三个",
                    type:"warning"
                })
            }
        },


        // 添加条件
        addOvertimeHolidaysHours(){
            let num = this.overtimeHolidaysHours.length;
            if(num<6){
                this.overtimeHolidaysHours.push({startName:""});
                this.overtimeHolidaysHours.push({endName:""});
            }else{
                this.$message({
                    message:"最多只能选添加三个",
                    type:"warning"
                })
            }
        },

        // 重置默认状态
        upHolidaysData(){
            if(this.holidays.breaks!=1){
                this.holidaysCount = [{startName:undefined},{endName:undefined}];
            }
            if(this.holidays.breaks!=2){
                this.overtimeHolidaysHours = [{startName:undefined},{endName:undefined}];
            }
        },

        // 删除时间段
        delHolidaysData(index){
            this.holidaysCount.splice(index-1,index-1);
        },
        // 删除添加的条件
        delOvertimeHolidaysHours(index){
            this.overtimeHolidaysHours.splice(index-1,index-1);
        },
        // 重置
        holidaysCompensatoryLeave(){
            this.holidays.compensatoryLeave = undefined;
        },
        // 节假日方法 end
        
    }
}
</script>

<style scoped>
    body {
        margin: 0;
    }
    .kuai{
        width:98%;
        /* border: 1px red solid; */
        position: relative;
        top: 30px;
        left: 55px;
    }
    .kuang{
        width: 3px;
        height: 20px;
        background-color: #409EFF;
        margin-left: 30px;
        position: relative;
        top: 23px;
    }
    .xian{
        width: 97.5%;
        height: 2px;
        background-color: #EBEEF5;
        margin-left: 40px;
        margin-top: 20px;
       
    }
    .el-row {
        margin-bottom: 20px;
    }
    .el-col {
        border-radius: 4px;
    }
    .bg-purple-dark {
        background: white;
    }
    .bg-purple {
        background: #d3dce6;
    }
    .bg-purple-light {
        background: #e5e9f2;
    }
    .grid-content {
        
        border-radius: 4px;
        min-height: 36px;
    }
    .row-bg {
        padding: 10px 0;
        background-color: #f9fafc;
    }


    .avatar-uploader-icon[data-v-4f621d38]{
        border: 1px solid rgba(198, 201, 208, 1);
        background-color: rgba(248, 248, 248, 1);
        border-radius: 50%;
    }
    .avatar-uploader-icon {
        font-size: 20px;
        color: #8c939d;
        width: 50px;
        height: 50px;
        line-height: 50px;
        text-align: center;
    }

    /* 获取负责人start */
    .architecture{
        width: 271px;
        height: 39px;
        padding-left: 20px;
        border-radius: 5px;
    }
    .architecture:hover{
        background-color: #f8f8f8;
    }
    .architectureActe{
        width: 271px;
        height: 39px;
        line-height: 39px;
        padding-left: 20px;
        border-radius: 5px;
        background-color: rgba(231, 244, 255, 1);;
    }
    /* 竖着的水平线 */
    .myHr{
        border-left: 2px solid#989DAA;;
        height:100%;
        left: 48%;
        top: 0px;
        position: absolute;
    }

    .log{
        width: 27px;
        height: 27px;
        background-color: rgba(158, 208, 255, 1);
        float: left;
        position: relative;
        top: 15%;
        border-radius: 50%;
    }
    .log img{
        width: 13px;
        height: 13px;
        position: relative;
        bottom: 15%;
        left: 25%;
    }
    /* 获取负责人end */

    /* 设置工作日，休息日，节假日选中 */
    .el-menu--horizontal>.el-menu-item.is-active{
        color: rgb(24, 144, 255) !important;
    }

    .el-menu-demo{
        width: 97.5%;
    }
</style>